<%@ page language="java" import="java.util.*,cn.sypt.yuhao.domain.*"
	pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/home/";
%>

<!DOCTYPE HTML>
<html>
<head>
<base href="<%=basePath%>">
<title>添加视频</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description"
	content="Charisma, a fully featured, responsive, HTML5, Bootstrap admin template.">
<meta name="author" content="Muhammad Usman">

<!-- The styles -->
<link id="bs-css" href="css/bootstrap-cerulean.min.css" rel="stylesheet">

<link href="css/charisma-app.css" rel="stylesheet">
<link href='bower_components/fullcalendar/dist/fullcalendar.css'
	rel='stylesheet'>
<link href='bower_components/fullcalendar/dist/fullcalendar.print.css'
	rel='stylesheet' media='print'>
<link href='bower_components/chosen/chosen.min.css' rel='stylesheet'>
<link href='bower_components/colorbox/example3/colorbox.css'
	rel='stylesheet'>
<link href='bower_components/responsive-tables/responsive-tables.css'
	rel='stylesheet'>
<link
	href='bower_components/bootstrap-tour/build/css/bootstrap-tour.min.css'
	rel='stylesheet'>
<link href='css/jquery.noty.css' rel='stylesheet'>
<link href='css/noty_theme_default.css' rel='stylesheet'>
<link href='css/elfinder.min.css' rel='stylesheet'>
<link href='css/elfinder.theme.css' rel='stylesheet'>
<link href='css/jquery.iphone.toggle.css' rel='stylesheet'>
<link href='css/uploadify.css' rel='stylesheet'>
<link href='css/animate.min.css' rel='stylesheet'>

<!-- jQuery -->
<script src="bower_components/jquery/jquery.min.js"></script>

<!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

<!-- The fav icon -->
<link rel="shortcut icon" href="img/favicon.ico">
<script language="javascript">
	function checkSub() {

		var flag = false;
		var bname = aform.bname.value;
		var spname = aform.spname.value;
		var spstr = aform.spstr.value;
		if (bname.trim() == "") {
			window.alert("学科实验不能为空!");
		} else if (spname.trim() == "") {
			window.alert("实验名称不能为空!");
		} else if (spstr.trim() == "") {
			window.alert("实验简介不能为空");
		} else {
			flag = true;
		}
		return flag;
	}
</script>

</head>
<script type="text/javascript">

function start(){
	var aid = $("#select2").val();
	$.ajax({
		type : "POST",
		url : "/sypt/VideoServlet",
		async : false,
		dataType : "json",
		data : {
			"method" : "findsanfenlei",
			"aid" : aid

		},
		success : function(data) {
			$("#select3 option").each(function() {
				if ($(this).val() != "") {
					$(this).remove();
				}
			});

			for (var i = 0; i < data.length; i++) {
				var op = $("<option id='option1' value="+data[i].bname+">"
						+ data[i].bname + "</option>");

				$("#select3").prepend(op);

			};
		}
		
	});
	
}

	function selecta() {
		var fid = $("#select1").val();
		$.ajax({
			type : "POST",
			url : "/sypt/VideoServlet",
			async : false,
			dataType : "json",
			data : {
				"method" : "finderfenlei",
				"fid" : fid

			},
			success : function(data) {
				$("#select2 option").each(function() {
					if ($(this).val() != "") {
						$(this).remove();
					}
				});

				for (var i = 0; i < data.length; i++) {
					var op = $("<option id='option1' value="+data[i].aid+">"
							+ data[i].aname + "</option>");

					$("#select2").prepend(op);

				};
				start();
				
			}
		});
		
	}
</script>
<body>
	<%@include file="/home/head.jsp"%>
	<!-- topbar ends -->
	<div class="ch-container">
		<div class="row">

			<!-- left menu starts -->
			<%@include file="/home/left.jsp"%>
			<!--/span-->
			<!-- left menu ends -->



			<div id="content" class="col-lg-10 col-sm-10">
				<!-- content starts -->
				<div>
					<ul class="breadcrumb">
						<li><a href="#">个人管理中心</a></li>
						<li><a href="#">我要上传实验</a></li>
					</ul>
				</div>

				<div class="row">
					<div class="box col-md-12">
						<div class="box-inner">
							<div class="box-header well" data-original-title="">
								<h2>
									<i class="glyphicon glyphicon-edit"></i> 我要贡献知识
								</h2>


							</div>
							<div class="box-content">







								<form action="<c:url value='/UploadServlet'/>" name="aform"
									method="post" enctype="multipart/form-data">




									<div class="control-group">
										<div class="controls">
											<table>
												<tr>
													<td><label class="control-label" for="selectError2">一级分类</label></td>
													<td><label class="control-label" for="selectError2"
														id="jkljkl">二级分类</label></td>
													<td><label class="control-label" for="selectError2">三级分类</label></td>
												</tr>
												<tr>
													<td><select id="select1" name="select1"
														onchange="selecta();" data-rel="chosen">
															<c:forEach items="${lista }" var="a">
																<option value="${a.fid }">${a.fname }</option>
															</c:forEach>

													</select></td>
													<td><select id="select2" name="select2" onchange="start();">
															<c:forEach items="${listb }" var="b">
																<option id="option1" value="${b.aid }">${b.aname }</option>
															</c:forEach>

													</select></td>
													<td><select id="select3" name="bname">
															<c:forEach items="${listc }" var="c">
																<option value="${c.bname }">${c.bname }</option>
															</c:forEach>

													</select></td>
												</tr>
											</table>




										</div>
									</div>

									<div class="box-content">


										<div class="form-group " style="width: 30%">
											<label for="exampleInputPassword1">实验名称</label> <input
												name="spname" type="text" class="form-control"
												id="inputSuccess1">
										</div>
										<div class="form-group " style="width: 65%">
											<label for="exampleInputPassword1">实验内容</label>
											<textarea class="form-control" name="spstr" id="con" rows="6"></textarea>
										</div>

										<div class="form-group">
											<label for="exampleInputFile">上传实验图片</label> <input
												name="sptpurl" type="file" id="exampleInputFile">
											<p class="help-block">图片大小为285*290px</p>

										</div>
										<div class="form-group">
											<label for="exampleInputFile">上传实验flash</label> <input
												name="spurl" type="file" id="exampleInputFile">

											<p class="help-block">flash文件名为swf格式</p>
										</div>
										<div class="form-group">
											<label for="exampleInputFile">上传实验相关文档</label> <input
												name="spwdurl" type="file" id="exampleInputFile">

											<p class="help-block">文档格式为doc,ppt,pdf</p>
										</div>

										<button type="submit" class="btn btn-default"
											onclick="return checkSub();">上传</button>
								</form>

							</div>
						</div>
					</div>
				</div>
				<!--/span-->

			</div>
			<!--/row-->


			<!--/row-->

			<!-- content ends -->
		</div>
		<!--/#content.col-md-0-->
	</div>
	<!--/fluid-row-->

	<!-- Ad, you can remove it -->

	<!-- Ad ends -->

	<hr>



	<jsp:include flush="true" page="foot.jsp"></jsp:include>

	</div>
	<!--/.fluid-container-->

	<!-- external javascript -->

	<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>

	<!-- library for cookie management -->
	<script src="js/jquery.cookie.js"></script>
	<!-- calender plugin -->
	<script src='bower_components/moment/min/moment.min.js'></script>
	<script src='bower_components/fullcalendar/dist/fullcalendar.min.js'></script>
	<!-- data table plugin -->
	<script src='js/jquery.dataTables.min.js'></script>

	<!-- select or dropdown enhancer -->
	<script src="bower_components/chosen/chosen.jquery.min.js"></script>
	<!-- plugin for gallery image view -->
	<script src="bower_components/colorbox/jquery.colorbox-min.js"></script>
	<!-- notification plugin -->
	<script src="js/jquery.noty.js"></script>
	<!-- library for making tables responsive -->
	<script src="bower_components/responsive-tables/responsive-tables.js"></script>
	<!-- tour plugin -->
	<script
		src="bower_components/bootstrap-tour/build/js/bootstrap-tour.min.js"></script>
	<!-- star rating plugin -->
	<script src="js/jquery.raty.min.js"></script>
	<!-- for iOS style toggle switch -->
	<script src="js/jquery.iphone.toggle.js"></script>
	<!-- autogrowing textarea plugin -->
	<script src="js/jquery.autogrow-textarea.js"></script>
	<!-- multiple file upload plugin -->
	<script src="js/jquery.uploadify-3.1.min.js"></script>
	<!-- history.js for cross-browser state change on ajax -->
	<script src="js/jquery.history.js"></script>
	<!-- application script for Charisma demo -->
	<script src="js/charisma.js"></script>
</body>
</html>

